<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>HTTP Response &mdash; cpp-netlib v0.12.0</title>
    
    <link rel="stylesheet" href="../_static/pyramid.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '0.12.0',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <link rel="top" title="cpp-netlib v0.12.0" href="../contents.html" />
    <link rel="up" title="Reference Manual" href="../reference.html" />
    <link rel="next" title="HTTP Server API" href="http_server.html" />
    <link rel="prev" title="HTTP Request" href="http_request.html" />
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
<!--[if lte IE 6]>
<link rel="stylesheet" href="../_static/ie6.css" type="text/css" media="screen" charset="utf-8" />
<![endif]-->

  </head>
  <body role="document">

    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="http_server.html" title="HTTP Server API"
             accesskey="N">next</a></li>
        <li class="right" >
          <a href="http_request.html" title="HTTP Request"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../contents.html">cpp-netlib v0.12.0</a> &raquo;</li>
          <li class="nav-item nav-item-1"><a href="../reference.html" accesskey="U">Reference Manual</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="http-response">
<h1>HTTP Response<a class="headerlink" href="#http-response" title="Permalink to this headline">¶</a></h1>
<p>This part of the documentation talks about the publicly accessible API of the
HTTP Response objects. This section details the <a class="reference internal" href="#response-concept">Response Concept</a> requirements,
the implemented and required <a class="reference internal" href="#directives">Directives</a>, <a class="reference internal" href="#modifiers">Modifiers</a>, and <a class="reference internal" href="#wrappers">Wrappers</a> that work
with the HTTP Response objects.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The HTTP server response object is a POD type, which doesn&#8217;t support
any of the following details. There are only a few fields available in the
HTTP server response type, which can be seen in
<code class="docutils literal"><span class="pre">boost/network/protocol/http/impl/response.ipp</span></code>.</p>
</div>
<div class="section" id="response-concept">
<h2>Response Concept<a class="headerlink" href="#response-concept" title="Permalink to this headline">¶</a></h2>
<p>A type models the Response Concept if it models the <a class="reference external" href="../in_depth/message.html#message-concept">Message Concept</a> and also
supports the following constructs.</p>
<p><strong>Legend</strong></p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">R:</th><td class="field-body">The response type.</td>
</tr>
<tr class="field-even field"><th class="field-name">r:</th><td class="field-body">An instance of R.</td>
</tr>
<tr class="field-odd field"><th class="field-name">S:</th><td class="field-body">The string type.</td>
</tr>
<tr class="field-even field"><th class="field-name">s,e,g:</th><td class="field-body">Instances of S.</td>
</tr>
<tr class="field-odd field"><th class="field-name">P:</th><td class="field-body">The port type.</td>
</tr>
<tr class="field-even field"><th class="field-name">p:</th><td class="field-body">An instance of P.</td>
</tr>
<tr class="field-odd field"><th class="field-name">V:</th><td class="field-body">The version type.</td>
</tr>
<tr class="field-even field"><th class="field-name">v:</th><td class="field-body">An instance of v.</td>
</tr>
<tr class="field-odd field"><th class="field-name">T:</th><td class="field-body">The status type.</td>
</tr>
<tr class="field-even field"><th class="field-name">t:</th><td class="field-body">An instance of T.</td>
</tr>
<tr class="field-odd field"><th class="field-name">M:</th><td class="field-body">The status message type.</td>
</tr>
<tr class="field-even field"><th class="field-name">m:</th><td class="field-body">An instance of M.</td>
</tr>
<tr class="field-odd field"><th class="field-name">U:</th><td class="field-body">An unsigned 16-bit int.</td>
</tr>
<tr class="field-even field"><th class="field-name">u:</th><td class="field-body">An instance of U.</td>
</tr>
</tbody>
</table>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">In the table below, the namespace <code class="docutils literal"><span class="pre">traits</span></code> is an alias for
<code class="docutils literal"><span class="pre">boost::network::http::traits</span></code>.</p>
</div>
<table border="1" class="docutils">
<colgroup>
<col width="49%" />
<col width="13%" />
<col width="38%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Construct</th>
<th class="head">Result</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><code class="docutils literal"><span class="pre">R::string_type</span></code></td>
<td><code class="docutils literal"><span class="pre">S</span></code></td>
<td>The nested <code class="docutils literal"><span class="pre">string_type</span></code>
type.</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">traits::version&lt;R&gt;::type</span></code></td>
<td><code class="docutils literal"><span class="pre">V</span></code></td>
<td>The version type associated
with R.</td>
</tr>
<tr class="row-even"><td><code class="docutils literal"><span class="pre">traits::status&lt;R&gt;::type</span></code></td>
<td><code class="docutils literal"><span class="pre">T</span></code></td>
<td>The status type associated
with R.</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">traits::status_message&lt;R&gt;::type</span></code></td>
<td><code class="docutils literal"><span class="pre">M</span></code></td>
<td>The status message type
associated with R.</td>
</tr>
<tr class="row-even"><td><code class="docutils literal"><span class="pre">r</span> <span class="pre">&lt;&lt;</span> <span class="pre">version(v)</span></code></td>
<td><code class="docutils literal"><span class="pre">R&amp;</span></code></td>
<td>Sets the version of <code class="docutils literal"><span class="pre">r</span></code>.</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">r</span> <span class="pre">&lt;&lt;</span> <span class="pre">status(t)</span></code></td>
<td><code class="docutils literal"><span class="pre">R&amp;</span></code></td>
<td>Sets the status of <code class="docutils literal"><span class="pre">r</span></code>.</td>
</tr>
<tr class="row-even"><td><code class="docutils literal"><span class="pre">r</span> <span class="pre">&lt;&lt;</span> <span class="pre">status_message(m)</span></code></td>
<td><code class="docutils literal"><span class="pre">R&amp;</span></code></td>
<td>Sets the status message of
<code class="docutils literal"><span class="pre">r</span></code>.</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">version(r,</span> <span class="pre">v)</span></code></td>
<td><code class="docutils literal"><span class="pre">void</span></code></td>
<td>Sets the version of <code class="docutils literal"><span class="pre">r</span></code>.</td>
</tr>
<tr class="row-even"><td><code class="docutils literal"><span class="pre">status(r,</span> <span class="pre">t)</span></code></td>
<td><code class="docutils literal"><span class="pre">void</span></code></td>
<td>Sets the status of <code class="docutils literal"><span class="pre">r</span></code>.</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">status_message(r,</span> <span class="pre">m)</span></code></td>
<td><code class="docutils literal"><span class="pre">void</span></code></td>
<td>Sets the status message of
<code class="docutils literal"><span class="pre">r</span></code>.</td>
</tr>
<tr class="row-even"><td><code class="docutils literal"><span class="pre">S</span> <span class="pre">e</span> <span class="pre">=</span> <span class="pre">version(r)</span></code></td>
<td><strong>NA</strong></td>
<td>Get the version of <code class="docutils literal"><span class="pre">r</span></code>.</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">U</span> <span class="pre">u</span> <span class="pre">=</span> <span class="pre">status(r)</span></code></td>
<td><strong>NA</strong></td>
<td>Get the status of <code class="docutils literal"><span class="pre">r</span></code>.</td>
</tr>
<tr class="row-even"><td><code class="docutils literal"><span class="pre">S</span> <span class="pre">g</span> <span class="pre">=</span> <span class="pre">status_message(r)</span></code></td>
<td><strong>NA</strong></td>
<td>Get the status message of
<code class="docutils literal"><span class="pre">r</span></code>.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="directives">
<h2>Directives<a class="headerlink" href="#directives" title="Permalink to this headline">¶</a></h2>
<p>This section details the provided directives that are provided by
<code class="xref py py-mod docutils literal"><span class="pre">cpp-netlib</span></code>. The section was written to assume that an appropriately
constructed response instance is either of the following:</p>
<div class="highlight-c++"><div class="highlight"><pre><span></span><span class="n">boost</span><span class="o">::</span><span class="n">network</span><span class="o">::</span><span class="n">http</span><span class="o">::</span><span class="n">basic_response</span><span class="o">&lt;</span>
  <span class="n">boost</span><span class="o">::</span><span class="n">network</span><span class="o">::</span><span class="n">http</span><span class="o">::</span><span class="n">tags</span><span class="o">::</span><span class="n">http_default_8bit_udp_resolve</span>
<span class="o">&gt;</span> <span class="n">response</span><span class="p">;</span>

<span class="c1">// or</span>

<span class="n">boost</span><span class="o">::</span><span class="n">network</span><span class="o">::</span><span class="n">http</span><span class="o">::</span><span class="n">basic_response</span><span class="o">&lt;</span>
  <span class="n">boost</span><span class="o">::</span><span class="n">network</span><span class="o">::</span><span class="n">http</span><span class="o">::</span><span class="n">tags</span><span class="o">::</span><span class="n">http_server</span>
<span class="o">&gt;</span> <span class="n">response</span><span class="p">;</span>
</pre></div>
</div>
<p>The section also assumes that there following using namespace declaration is in
effect:</p>
<div class="highlight-c++"><div class="highlight"><pre><span></span><span class="k">using</span> <span class="k">namespace</span> <span class="n">boost</span><span class="o">::</span><span class="n">network</span><span class="p">;</span>
</pre></div>
</div>
<p>Directives are meant to be used in the following manner:</p>
<div class="highlight-c++"><div class="highlight"><pre><span></span><span class="n">response</span> <span class="o">&lt;&lt;</span> <span class="n">directive</span><span class="p">(...);</span>
</pre></div>
</div>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p>There are four versions of directives, those that are applicable
to messages that support narrow strings (<code class="docutils literal"><span class="pre">std::string</span></code>), those that are
applicable to messages that support wide strings (<code class="docutils literal"><span class="pre">std::wstring</span></code>), those
that are applicable to messages that support future-wrapped narrow and wide
strings (<code class="docutils literal"><span class="pre">boost::shared_future&lt;std::string&gt;</span></code> and
<code class="docutils literal"><span class="pre">boost::shared_future&lt;std::wstring&gt;</span></code>).</p>
<p>The <code class="xref py py-mod docutils literal"><span class="pre">cpp-netlib</span></code> implementation still does not convert wide strings into
UTF-8 encoded narrow strings. This will be implemented in subsequent
library releases.</p>
<p class="last">For now all the implemented directives are listed, even if some of them still
do not implement things correctly.</p>
</div>
<dl class="docutils">
<dt><em>unspecified</em> <code class="docutils literal"><span class="pre">source(std::string</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">source_)</span></code></dt>
<dd>Create a source directive with a <code class="docutils literal"><span class="pre">std::string</span></code> as a parameter, to be set
as the source of the response.</dd>
<dt><em>unspecified</em> <code class="docutils literal"><span class="pre">source(std::wstring</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">source_)</span></code></dt>
<dd>Create a source directive with a <code class="docutils literal"><span class="pre">std::wstring</span></code> as a parameter, to be set
as the source of the response.</dd>
<dt><em>unspecified</em> <code class="docutils literal"><span class="pre">source(boost::shared_future&lt;std::string&gt;</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">source_)</span></code></dt>
<dd>Create a source directive with a <code class="docutils literal"><span class="pre">boost::shared_future&lt;std::string&gt;</span></code> as a parameter, to be set
as the source of the response.</dd>
<dt><em>unspecified</em> <code class="docutils literal"><span class="pre">source(boost::shared_future&lt;std::wstring&gt;</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">source_)</span></code></dt>
<dd>Create a source directive with a <code class="docutils literal"><span class="pre">boost::shared_future&lt;std::wstring&gt;</span></code> as a parameter, to be set
as the source of the response.</dd>
<dt><em>unspecified</em> <code class="docutils literal"><span class="pre">destination(std::string</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">source_)</span></code></dt>
<dd>Create a destination directive with a <code class="docutils literal"><span class="pre">std::string</span></code> as a parameter, to be
set as the destination of the response.</dd>
<dt><em>unspecified</em> <code class="docutils literal"><span class="pre">destination(std::wstring</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">source_)</span></code></dt>
<dd>Create a destination directive with a <code class="docutils literal"><span class="pre">std::wstring</span></code> as a parameter, to be
set as the destination of the response.</dd>
<dt><em>unspecified</em> <code class="docutils literal"><span class="pre">destination(boost::shared_future&lt;std::string&gt;</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">destination_)</span></code></dt>
<dd>Create a destination directive with a <code class="docutils literal"><span class="pre">boost::shared_future&lt;std::string&gt;</span></code> as a parameter, to be set
as the destination of the response.</dd>
<dt><em>unspecified</em> <code class="docutils literal"><span class="pre">destination(boost::shared_future&lt;std::wstring&gt;</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">destination_)</span></code></dt>
<dd>Create a destination directive with a <code class="docutils literal"><span class="pre">boost::shared_future&lt;std::wstring&gt;</span></code> as a parameter, to be set
as the destination of the response.</dd>
<dt><em>unspecified</em> <code class="docutils literal"><span class="pre">header(std::string</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">name,</span> <span class="pre">std::string</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">value)</span></code></dt>
<dd>Create a header directive that will add the given name and value pair to the
headers already associated with the response. In this case the name and
values are both <code class="docutils literal"><span class="pre">std::string</span></code>.</dd>
<dt><em>unspecified</em> <code class="docutils literal"><span class="pre">header(std::wstring</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">name,</span> <span class="pre">std::wstring</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">value)</span></code></dt>
<dd>Create a header directive that will add the given name and value pair to the
headers already associated with the response. In this case the name and
values are both <code class="docutils literal"><span class="pre">std::wstring</span></code>.</dd>
<dt><em>unspecified</em> <code class="docutils literal"><span class="pre">remove_header(std::string</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">name)</span></code></dt>
<dd>Create a remove_header directive that will remove all the occurences of the
given name from the headers already associated with the response. In this
case the name of the header is of type <code class="docutils literal"><span class="pre">std::string</span></code>.</dd>
<dt><em>unspecified</em> <code class="docutils literal"><span class="pre">remove_header(std::wstring</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">name)</span></code></dt>
<dd>Create a remove_header directive that will remove all the occurences of the
given name from the headers already associated with the response. In this
case the name of the header is of type <code class="docutils literal"><span class="pre">std::wstring</span></code>.</dd>
<dt><em>unspecified</em> <code class="docutils literal"><span class="pre">body(std::string</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">body_)</span></code></dt>
<dd>Create a body directive that will set the response&#8217;s body to the given
parameter. In this case the type of the body is an <code class="docutils literal"><span class="pre">std::string</span></code>.</dd>
<dt><em>unspecified</em> <code class="docutils literal"><span class="pre">body(std::wstring</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">body_)</span></code></dt>
<dd>Create a body directive that will set the response&#8217;s body to the given
parameter. In this case the type of the body is an <code class="docutils literal"><span class="pre">std::wstring</span></code>.</dd>
<dt><em>unspecified</em> <code class="docutils literal"><span class="pre">body(boost::shared_future&lt;std::string&gt;</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">body_)</span></code></dt>
<dd>Create a body directive that will set the response&#8217;s body to the given
parameter. In this case the type of the body is an <code class="docutils literal"><span class="pre">boost::shared_future&lt;std::string&gt;</span></code>.</dd>
<dt><em>unspecified</em> <code class="docutils literal"><span class="pre">body(boost::shared_future&lt;std::wstring&gt;</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">body_)</span></code></dt>
<dd>Create a body directive that will set the response&#8217;s body to the given
parameter. In this case the type of the body is an <code class="docutils literal"><span class="pre">boost::shared_future&lt;std::wstring&gt;</span></code>.</dd>
<dt><em>unspecified</em> <code class="docutils literal"><span class="pre">version(std::string</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">version_)</span></code></dt>
<dd><p class="first">Create a version directive that will set the response&#8217;s version to the given
parameter. In this case the type of the version is an <code class="docutils literal"><span class="pre">std::string</span></code>.</p>
<p class="last">Note that this version includes the full <code class="docutils literal"><span class="pre">&quot;HTTP/&quot;</span></code> string.</p>
</dd>
<dt><em>unspecified</em> <code class="docutils literal"><span class="pre">version(std::wstring</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">version_)</span></code></dt>
<dd><p class="first">Create a version directive that will set the response&#8217;s version to the given
parameter. In this case the type of the version is an <code class="docutils literal"><span class="pre">std::wstring</span></code>.</p>
<p class="last">Note that this version includes the full <code class="docutils literal"><span class="pre">&quot;HTTP/&quot;</span></code> string.</p>
</dd>
<dt><em>unspecified</em> <code class="docutils literal"><span class="pre">version(boost::shared_future&lt;std::string&gt;</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">version_)</span></code></dt>
<dd><p class="first">Create a version directive that will set the response&#8217;s version to the given
parameter. In this case the type of the version is an <code class="docutils literal"><span class="pre">boost::shared_future&lt;std::string&gt;</span></code>.</p>
<p class="last">Note that this version includes the full <code class="docutils literal"><span class="pre">&quot;HTTP/&quot;</span></code> string.</p>
</dd>
<dt><em>unspecified</em> <code class="docutils literal"><span class="pre">version(boost::shared_future&lt;std::wstring&gt;</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">version_)</span></code></dt>
<dd><p class="first">Create a version directive that will set the response&#8217;s version to the given
parameter. In this case the type of the version is an <code class="docutils literal"><span class="pre">boost::shared_future&lt;std::wstring&gt;</span></code>.</p>
<p class="last">Note that this version includes the full <code class="docutils literal"><span class="pre">&quot;HTTP/&quot;</span></code> string.</p>
</dd>
<dt><em>unspecified</em> <code class="docutils literal"><span class="pre">status_message(std::string</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">status_message_)</span></code></dt>
<dd><p class="first">Create a status_message directive that will set the response&#8217;s status_message to the given
parameter. In this case the type of the status_message is an <code class="docutils literal"><span class="pre">std::string</span></code>.</p>
<p class="last">Note that this status_message includes the full <code class="docutils literal"><span class="pre">&quot;HTTP/&quot;</span></code> string.</p>
</dd>
<dt><em>unspecified</em> <code class="docutils literal"><span class="pre">status_message(std::wstring</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">status_message_)</span></code></dt>
<dd><p class="first">Create a status_message directive that will set the response&#8217;s status_message to the given
parameter. In this case the type of the status_message is an <code class="docutils literal"><span class="pre">std::wstring</span></code>.</p>
<p class="last">Note that this status_message includes the full <code class="docutils literal"><span class="pre">&quot;HTTP/&quot;</span></code> string.</p>
</dd>
<dt><em>unspecified</em> <code class="docutils literal"><span class="pre">status_message(boost::shared_future&lt;std::string&gt;</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">status_message_)</span></code></dt>
<dd><p class="first">Create a status_message directive that will set the response&#8217;s status_message to the given
parameter. In this case the type of the status_message is an <code class="docutils literal"><span class="pre">boost::shared_future&lt;std::string&gt;</span></code>.</p>
<p class="last">Note that this status_message includes the full <code class="docutils literal"><span class="pre">&quot;HTTP/&quot;</span></code> string.</p>
</dd>
<dt><em>unspecified</em> <code class="docutils literal"><span class="pre">status_message(boost::shared_future&lt;std::wstring&gt;</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">status_message_)</span></code></dt>
<dd><p class="first">Create a status_message directive that will set the response&#8217;s status_message to the given
parameter. In this case the type of the status_message is an <code class="docutils literal"><span class="pre">boost::shared_future&lt;std::wstring&gt;</span></code>.</p>
<p class="last">Note that this status_message includes the full <code class="docutils literal"><span class="pre">&quot;HTTP/&quot;</span></code> string.</p>
</dd>
<dt><em>unspecified</em> <code class="docutils literal"><span class="pre">status(boost::uint16_t</span> <span class="pre">status_)</span></code></dt>
<dd>Create a status directive that will set the response&#8217;s status to the given
parameter. In this case the type of <code class="docutils literal"><span class="pre">status_</span></code> is <code class="docutils literal"><span class="pre">boost::uint16_t</span></code>.</dd>
<dt><em>unspecified</em> <code class="docutils literal"><span class="pre">status(boost::shared_future&lt;boost::uint16_t&gt;</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">status_)</span></code></dt>
<dd>Create a status directive that will set the response&#8217;s status to the given
parameter. In this case the type of <code class="docutils literal"><span class="pre">status_</span></code> is <code class="docutils literal"><span class="pre">boost::shared_future&lt;boost::uint16_t&gt;</span></code>.</dd>
</dl>
</div>
<div class="section" id="modifiers">
<h2>Modifiers<a class="headerlink" href="#modifiers" title="Permalink to this headline">¶</a></h2>
<p>This section details the provided modifiers that are provided by
<code class="xref py py-mod docutils literal"><span class="pre">cpp-netlib</span></code>.</p>
<dl class="docutils">
<dt><code class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">Tag&gt;</span> <span class="pre">inline</span> <span class="pre">void</span> <span class="pre">source(basic_response&lt;Tag&gt;</span> <span class="pre">&amp;</span> <span class="pre">response,</span> <span class="pre">typename</span> <span class="pre">string&lt;Tag&gt;::type</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">source_)</span></code></dt>
<dd>Modifies the source of the given <code class="docutils literal"><span class="pre">response</span></code>. The type of <code class="docutils literal"><span class="pre">source_</span></code> is
dependent on the <code class="docutils literal"><span class="pre">Tag</span></code> specialization of <code class="docutils literal"><span class="pre">basic_response</span></code>.</dd>
<dt><code class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">Tag&gt;</span> <span class="pre">inline</span> <span class="pre">void</span> <span class="pre">source(basic_response&lt;Tag&gt;</span> <span class="pre">&amp;</span> <span class="pre">response,</span> <span class="pre">boost::shared_future&lt;typename</span> <span class="pre">string&lt;Tag&gt;::type&gt;</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">source_)</span></code></dt>
<dd>Modifies the source of the given <code class="docutils literal"><span class="pre">response</span></code>. The type of <code class="docutils literal"><span class="pre">source_</span></code> is
dependent on the <code class="docutils literal"><span class="pre">Tag</span></code> specialization of <code class="docutils literal"><span class="pre">basic_response</span></code>.</dd>
<dt><code class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">Tag&gt;</span> <span class="pre">inline</span> <span class="pre">void</span> <span class="pre">destination(basic_response&lt;Tag&gt;</span> <span class="pre">&amp;</span> <span class="pre">response,</span> <span class="pre">typename</span> <span class="pre">string&lt;Tag&gt;::type</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">destination_)</span></code></dt>
<dd>Modifies the destination of the given <code class="docutils literal"><span class="pre">response</span></code>. The type of <code class="docutils literal"><span class="pre">destination_</span></code> is
dependent on the <code class="docutils literal"><span class="pre">Tag</span></code> specialization of <code class="docutils literal"><span class="pre">basic_response</span></code>.</dd>
<dt><code class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">Tag&gt;</span> <span class="pre">inline</span> <span class="pre">void</span> <span class="pre">destination(basic_response&lt;Tag&gt;</span> <span class="pre">&amp;</span> <span class="pre">response,</span> <span class="pre">boost::shared_future&lt;typename</span> <span class="pre">string&lt;Tag&gt;::type&gt;</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">destination_)</span></code></dt>
<dd>Modifies the destination of the given <code class="docutils literal"><span class="pre">response</span></code>. The type of <code class="docutils literal"><span class="pre">destination_</span></code> is
dependent on the <code class="docutils literal"><span class="pre">Tag</span></code> specialization of <code class="docutils literal"><span class="pre">basic_response</span></code>.</dd>
<dt><code class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">Tag&gt;</span> <span class="pre">inline</span> <span class="pre">void</span> <span class="pre">add_header(basic_response&lt;Tag&gt;</span> <span class="pre">&amp;</span> <span class="pre">response,</span> <span class="pre">typename</span> <span class="pre">string&lt;Tag&gt;::type</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">name,</span> <span class="pre">typename</span> <span class="pre">string&lt;Tag&gt;::type</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">value)</span></code></dt>
<dd>Adds a header to the given <code class="docutils literal"><span class="pre">response</span></code>. The type of the <code class="docutils literal"><span class="pre">name</span></code> and
<code class="docutils literal"><span class="pre">value</span></code> parameters are dependent on the <code class="docutils literal"><span class="pre">Tag</span></code> specialization of
<code class="docutils literal"><span class="pre">basic_response</span></code>.</dd>
<dt><code class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">Tag&gt;</span> <span class="pre">inline</span> <span class="pre">void</span> <span class="pre">remove_header(basic_response&lt;Tag&gt;</span> <span class="pre">&amp;</span> <span class="pre">response,</span> <span class="pre">typename</span> <span class="pre">string&lt;Tag&gt;::type</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">name)</span></code></dt>
<dd>Removes a header from the given <code class="docutils literal"><span class="pre">response</span></code>. The type of the <code class="docutils literal"><span class="pre">name</span></code>
parameter is dependent on the <code class="docutils literal"><span class="pre">Tag</span></code> specialization of <code class="docutils literal"><span class="pre">basic_response</span></code>.</dd>
<dt><code class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">Tag&gt;</span> <span class="pre">inline</span> <span class="pre">void</span> <span class="pre">headers(basic_response&lt;Tag&gt;</span> <span class="pre">&amp;</span> <span class="pre">response,</span> <span class="pre">typename</span> <span class="pre">headers_container&lt;basic_response&lt;Tag&gt;</span> <span class="pre">&gt;::type</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">headers_)</span></code></dt>
<dd>Sets the whole headers contained in <code class="docutils literal"><span class="pre">response</span></code> as the given parameter
<code class="docutils literal"><span class="pre">headers_</span></code>.</dd>
<dt><code class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">Tag&gt;</span> <span class="pre">inline</span> <span class="pre">void</span> <span class="pre">headers(basic_response&lt;Tag&gt;</span> <span class="pre">&amp;</span> <span class="pre">response,</span> <span class="pre">boost::shared_future&lt;typename</span> <span class="pre">headers_container&lt;basic_response&lt;Tag&gt;</span> <span class="pre">&gt;::type&gt;</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">headers_)</span></code></dt>
<dd>Sets the whole headers contained in <code class="docutils literal"><span class="pre">response</span></code> as the given parameter
<code class="docutils literal"><span class="pre">headers_</span></code>.</dd>
<dt><code class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">Tag&gt;</span> <span class="pre">inline</span> <span class="pre">void</span> <span class="pre">clear_headers(basic_response&lt;Tag&gt;</span> <span class="pre">&amp;</span> <span class="pre">response)</span></code></dt>
<dd>Removes all headers from the given <code class="docutils literal"><span class="pre">response</span></code>.</dd>
<dt><code class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">Tag&gt;</span> <span class="pre">inline</span> <span class="pre">void</span> <span class="pre">body(basic_response&lt;Tag&gt;</span> <span class="pre">&amp;</span> <span class="pre">response,</span> <span class="pre">typename</span> <span class="pre">string&lt;Tag&gt;::type</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">body_)</span></code></dt>
<dd>Modifies the body of the given <code class="docutils literal"><span class="pre">response</span></code>. The type of <code class="docutils literal"><span class="pre">body_</span></code> is
dependent on the <code class="docutils literal"><span class="pre">Tag</span></code> specialization of <code class="docutils literal"><span class="pre">basic_response</span></code>.</dd>
<dt><code class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">Tag&gt;</span> <span class="pre">inline</span> <span class="pre">void</span> <span class="pre">body(basic_response&lt;Tag&gt;</span> <span class="pre">&amp;</span> <span class="pre">response,</span> <span class="pre">boost::shared_future&lt;typename</span> <span class="pre">string&lt;Tag&gt;::type&gt;</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">body_)</span></code></dt>
<dd>Modifies the body of the given <code class="docutils literal"><span class="pre">response</span></code>. The type of <code class="docutils literal"><span class="pre">body_</span></code> is
dependent on the <code class="docutils literal"><span class="pre">Tag</span></code> specialization of <code class="docutils literal"><span class="pre">basic_response</span></code>.</dd>
<dt><code class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">Tag&gt;</span> <span class="pre">inline</span> <span class="pre">void</span> <span class="pre">version(basic_response&lt;Tag&gt;</span> <span class="pre">&amp;</span> <span class="pre">response,</span> <span class="pre">typename</span> <span class="pre">traits::version&lt;basic_response&lt;Tag&gt;</span> <span class="pre">&gt;::type</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">version_)</span></code></dt>
<dd>Modifies the version of the given <code class="docutils literal"><span class="pre">response</span></code>. The type of <code class="docutils literal"><span class="pre">version_</span></code> is
dependent on the <code class="docutils literal"><span class="pre">Tag</span></code> specialization of <code class="docutils literal"><span class="pre">basic_response</span></code>.</dd>
<dt><code class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">Tag&gt;</span> <span class="pre">inline</span> <span class="pre">void</span> <span class="pre">status(basic_response&lt;Tag&gt;</span> <span class="pre">&amp;</span> <span class="pre">response,</span> <span class="pre">typename</span> <span class="pre">traits::status&lt;basic_response&lt;Tag&gt;</span> <span class="pre">&gt;::type</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">status_)</span></code></dt>
<dd>Modifies the status of the given <code class="docutils literal"><span class="pre">response</span></code>. The type of <code class="docutils literal"><span class="pre">status_</span></code> is
dependent on the <code class="docutils literal"><span class="pre">Tag</span></code> specialization of <code class="docutils literal"><span class="pre">basic_response</span></code>.</dd>
<dt><code class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">Tag&gt;</span> <span class="pre">inline</span> <span class="pre">void</span> <span class="pre">status_message(basic_response&lt;Tag&gt;</span> <span class="pre">&amp;</span> <span class="pre">response,</span> <span class="pre">typename</span> <span class="pre">traits::status_message&lt;basic_response&lt;Tag&gt;</span> <span class="pre">&gt;::type</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">status_message_)</span></code></dt>
<dd>Modifies the status message of the given <code class="docutils literal"><span class="pre">response</span></code>. The type of <code class="docutils literal"><span class="pre">status_message_</span></code> is
dependent on the <code class="docutils literal"><span class="pre">Tag</span></code> specialization of <code class="docutils literal"><span class="pre">basic_response</span></code>.</dd>
</dl>
</div>
<div class="section" id="wrappers">
<h2>Wrappers<a class="headerlink" href="#wrappers" title="Permalink to this headline">¶</a></h2>
<p>This section details the provided response wrappers that come with
<code class="xref py py-mod docutils literal"><span class="pre">cpp-netlib</span></code>. Wrappers are used to convert a message into a different type,
usually providing accessor operations to retrieve just part of the message. This
section assumes that the following using namespace directives are in
effect:</p>
<div class="highlight-c++"><div class="highlight"><pre><span></span><span class="k">using</span> <span class="k">namespace</span> <span class="n">boost</span><span class="o">::</span><span class="n">network</span><span class="p">;</span>
<span class="k">using</span> <span class="k">namespace</span> <span class="n">boost</span><span class="o">::</span><span class="n">network</span><span class="o">::</span><span class="n">http</span><span class="p">;</span>
</pre></div>
</div>
<dl class="docutils">
<dt><code class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">Tag&gt;</span></code> <em>unspecified</em> <code class="docutils literal"><span class="pre">source(basic_response&lt;Tag&gt;</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">response)</span></code></dt>
<dd>Returns a wrapper convertible to <code class="docutils literal"><span class="pre">typename</span> <span class="pre">string&lt;Tag&gt;::type</span></code> that
provides the source of a given response.</dd>
<dt><code class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">Tag&gt;</span></code> <em>unspecified</em> <code class="docutils literal"><span class="pre">destination(basic_response&lt;Tag&gt;</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">response)</span></code></dt>
<dd>Returns a wrapper convertible to <code class="docutils literal"><span class="pre">typename</span> <span class="pre">string&lt;Tag&gt;::type</span></code> that
provides the destination of a given response.</dd>
<dt><code class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">Tag&gt;</span></code> <em>unspecified</em> <code class="docutils literal"><span class="pre">headers(basic_response&lt;Tag&gt;</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">response)</span></code></dt>
<dd>Returns a wrapper convertible to <code class="docutils literal"><span class="pre">typename</span> <span class="pre">headers_range&lt;basic_response&lt;Tag&gt;</span>
<span class="pre">&gt;::type</span></code> or <code class="docutils literal"><span class="pre">typename</span> <span class="pre">basic_response&lt;Tag&gt;::headers_container_type</span></code> that
provides the headers of a given response.</dd>
<dt><code class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">Tag&gt;</span></code> <em>unspecified</em> <code class="docutils literal"><span class="pre">body(basic_response&lt;Tag&gt;</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">response)</span></code></dt>
<dd>Returns a wrapper convertible to <code class="docutils literal"><span class="pre">typename</span> <span class="pre">string&lt;Tag&gt;::type</span></code> that
provides the body of a given response.</dd>
<dt><code class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">Tag&gt;</span></code> <em>unspecified</em> <code class="docutils literal"><span class="pre">version(basic_response&lt;Tag&gt;</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">response)</span></code></dt>
<dd>Returns a wrapper convertible to <code class="docutils literal"><span class="pre">typename</span> <span class="pre">string&lt;Tag&gt;::type</span></code> that
provides the version of the given response.</dd>
<dt><code class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">Tag&gt;</span></code> <em>unspecified</em> <code class="docutils literal"><span class="pre">status(basic_response&lt;Tag&gt;</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">response)</span></code></dt>
<dd>Returns a wrapper convertible to <code class="docutils literal"><span class="pre">typename</span> <span class="pre">boost::uint16_t</span></code> that
provides the status of the given response.</dd>
<dt><code class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">Tag&gt;</span></code> <em>unspecified</em> <code class="docutils literal"><span class="pre">status_message(basic_response&lt;Tag&gt;</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">response)</span></code></dt>
<dd>Returns a wrapper convertible to <code class="docutils literal"><span class="pre">typename</span> <span class="pre">string&lt;Tag&gt;::type</span></code> that
provides the status message of the given response.</dd>
</dl>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../contents.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">HTTP Response</a><ul>
<li><a class="reference internal" href="#response-concept">Response Concept</a></li>
<li><a class="reference internal" href="#directives">Directives</a></li>
<li><a class="reference internal" href="#modifiers">Modifiers</a></li>
<li><a class="reference internal" href="#wrappers">Wrappers</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="http_request.html"
                        title="previous chapter">HTTP Request</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="http_server.html"
                        title="next chapter">HTTP Server API</a></p>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="http_server.html" title="HTTP Server API"
             >next</a></li>
        <li class="right" >
          <a href="http_request.html" title="HTTP Request"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../contents.html">cpp-netlib v0.12.0</a> &raquo;</li>
          <li class="nav-item nav-item-1"><a href="../reference.html" >Reference Manual</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &copy; Copyright 2008-2014, Glyn Matthews, Dean Michael Berris; 2013 Google, Inc..
      Last updated on Mar 29, 2016.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.6.
    </div>
  </body>
</html>